package com.demo.ext.user.controller;

import com.demo.common.model.User;
import com.demo.ext.blog.BlogInterceptor;
import com.demo.ext.user.UserService;
import com.jfinal.aop.Before;
import com.jfinal.aop.Inject;
import com.jfinal.core.Controller;
import com.jfinal.core.Path;
import com.jfinal.plugin.activerecord.Page;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: linKe
 * @Date: 2022/4/11 14:31
 * @ClassName: UserController
 * @Version: 1.0
 * @Description:
 */
@RestController
@RequestMapping("/user")
public class UserController extends Controller {
    @Inject
    UserService userService;
    @GetMapping("/index")
    void index(){
        Page<User> paginate = userService.paginate(getParaToInt(0, 1), 10);
        renderText(paginate.toString());
    }

    @GetMapping("/test")
    void test(){
        User byId = userService.findById(1);
        System.out.println(byId);
    }
}
